package speed2010.util;

import speed2010.middleware.comunicacao.Address;

public class MetaInfo {
	private long time = -1;
	private float tempoTotal = -1;
	private Address addressPI = null;
	private float custo = -1;
	private long idConsulta = -1;
	private String local = null;

	public MetaInfo(float tempoTotal, Address addressPI, float custo,
			long idConsulta, String local) {
		super();
		this.time = System.currentTimeMillis();
		this.tempoTotal = tempoTotal;
		this.addressPI = addressPI;
		this.custo = custo;
		this.idConsulta = idConsulta;
		this.local = local;
	}

	@Override
	public boolean equals(Object obj) {
		return (this.idConsulta == ((MetaInfo) obj).idConsulta)
				&& (this.tempoTotal == ((MetaInfo) obj).tempoTotal)
				&& (this.local.equalsIgnoreCase(((MetaInfo) obj).local));
	}

	@Override
	public String toString() {
		return Util.formataEmHora(this.time) + " - A consulta id(" + idConsulta
				+ ") integrada em " + addressPI + " com o custo de " + custo
				+ " demorou " + Util.format2(tempoTotal) + " em um " + local;
	}

	public float getTempoTotal() {
		return tempoTotal;
	}

	public void setTempoTotal(float tempoTotal) {
		this.tempoTotal = tempoTotal;
	}

	public Address getAddressPI() {
		return addressPI;
	}

	public void setAddressPI(Address addressPI) {
		this.addressPI = addressPI;
	}

	public float getCusto() {
		return custo;
	}

	public void setCusto(float custo) {
		this.custo = custo;
	}

	public long getIdConsulta() {
		return idConsulta;
	}

	public void setIdConsulta(long idConsulta) {
		this.idConsulta = idConsulta;
	}

	public String getLocal() {
		return local;
	}

	public void setLocal(String local) {
		this.local = local;
	}

}
